using System;
using System.IO;
using System.Collections.Generic;
using System.Text;

using Walkmen.Util;

namespace Walkmen.OpenMG
{
    public class OMATextFrame: OMAFrame
    {
        public const string FRAME_ID_TPE1 = "TPE1";
        public const string FRAME_ID_TIT2 = "TIT2";
        public const string FRAME_ID_TALB = "TALB";
        public const string FRAME_ID_TRCK = "TRCK";

        private OMAEncoding _encoding;
        private string _value;

        public OMAEncoding Encoding
        {
            get { return _encoding; }
            set { _encoding = value; }
        }

        public string Value
        {
            get { return _value; }
            set { _value = value; }
        }

        protected override void ParseValue(byte[] value)
        {
            _encoding = (OMAEncoding)value[0];
            Encoding encoding = CodeToEncoding(_encoding);

            string text = encoding.GetString(value, 1, value.Length - 1);
            _value = StringUtils.TrimEx(text);
        }
    }
}
